package code;

public class PCounter {

	/**
	 * @param args
	 */
	
	private static int pagesAllocated = 0;
	private static int pagesDeallocated = 0;
	private static int readCounter = 0;
	private static int writeCounter = 0;
	private static int no_of_files = 0;
	private static int pagesPinned = 0;
	private static int pagesUnpinned = 0;
	private static int pagesLoaded = 0;
	private static int pagesUnLoaded = 0;
	
	public static String getStats(){
		StringBuffer buf = new StringBuffer(1000);
		buf.append("[Pages Allocated: " + pagesAllocated+"]");
		buf.append("[Pages Deallocated: " + pagesDeallocated+"]");
		buf.append("[Read Counter: " + readCounter+"]");
		buf.append("[Write Counter: " + writeCounter+"]");
		buf.append("[No of Files: " + no_of_files+"]");
		return buf.toString();
	}
	
	public static void getStatistics () {
		System.out.println("Pages Allocated: " + pagesAllocated);
		System.out.println("Pages Deallocated: " + pagesDeallocated);
		System.out.println("Read Counter: " + readCounter);
		System.out.println("Write Counter: " + writeCounter);
		System.out.println("No of Files: " + no_of_files);
	}
	
	public static void add_a_file () {
		no_of_files++;
	}
	
	public static int get_no_of_files () {
		return no_of_files;
	}
	
	public static void readIncrement () {
		readCounter++;
	}
	
	public static void writeIncrement () {
		writeCounter++;
	}
	
	
	public static int getreadCounter () {
		return readCounter;
	}
	
	public static int getwriteCounter () {
		return writeCounter;
	}
	
	public static int getPagesAllocated() {
		return pagesAllocated;
	}

	public static void incrementPagesAllocated () {
		pagesAllocated++;
	}
	
	public static void allocateNPages (int allocatedPages) {
		pagesAllocated += allocatedPages;
	}

	public static int getPagesDeallocated() {
		return pagesDeallocated;
	}

	public static void incrementPagesDeallocated () {
		pagesDeallocated++;
	}
	
	public static void deallocateNPages (int deallocatedPages) {
		pagesDeallocated -= deallocatedPages;
	}

	public static int getPagesPinned() {
		return pagesPinned;
	}

	public static void setPagesPinned(int pagesPinned) {
		PCounter.pagesPinned = pagesPinned;
	}

	public static int getPagesUnpinned() {
		return pagesUnpinned;
	}

	public static void setPagesUnpinned(int pagesUnpinned) {
		PCounter.pagesUnpinned = pagesUnpinned;
	}

	public static int getPagesLoaded() {
		return pagesLoaded;
	}

	public static void incrementPagesLoaded() {
		pagesLoaded++;
	}

	public static int getPagesUnLoaded() {
		return pagesUnLoaded;
	}

	public static void incrementPagesUnloaded() {
		pagesUnLoaded++;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
